import logging


def create_logger() -> logging.Logger:
    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG)

    file_handler = logging.FileHandler("../logs/app.log", mode="w")
    console_handler = logging.StreamHandler()

    logger.addHandler(file_handler)
    logger.addHandler(console_handler)
    # Logging记录格式以及设置
    formatter = logging.Formatter("%(asctime)s - %(message)s")  # 记录时间和消息
    file_handler.setFormatter(formatter)
    console_handler.setFormatter(formatter)
    return logger
